package com.wsf.swagger1.swaggerconfig.controller;

import com.wsf.swagger1.swaggerconfig.entity.User;
import com.wsf.swagger1.swaggerconfig.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "user")
@RestController
public class UserController {

    @Autowired
    private UserService userService;

    @ApiOperation("添加用户信息")
    @PutMapping("/addUser")
    public int AddUser(User user){
        System.out.println(user.getCreatetime());
        return userService.insertUser(user);
    }

    @ApiOperation("删除用户信息")
    @PutMapping("/deleteUser")
    public int DeleteUser(int id){
        System.out.println(id);
        return userService.deleteUser(id);
    }

    @ApiOperation("更新用户信息")
    @PutMapping("/updateUser")
    public int UpdateUser(User user){
        System.out.println(user.getAppid());
        return userService.updateUser(user);
    }

    @ApiOperation("查看用户信息")
    @PutMapping("/selectUser")
    public void SelectUser(int id){
        userService.selectUser(id);
    }
}
